//
//  imageCollectionViewCell.m
//  timemovie
//
//  Created by Yiqiao on 15/7/22.
//  Copyright (c) 2015年 Yiqiao. All rights reserved.
//

#import "imageCollectionViewCell.h"
#import "UIImageView+WebCache.h"
@implementation imageCollectionViewCell

- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    
    if (self) {
        [self _createSubview];
    }
    return self;
}

- (void)_createSubview{
    _imageView = [[UIImageView alloc]initWithFrame:self.bounds];
    _imageView.layer.cornerRadius = 20;
    _imageView.layer.borderColor = [UIColor whiteColor].CGColor;
    _imageView.layer.borderWidth = 1;
    
    _imageView.layer.masksToBounds = YES;
    [self.contentView addSubview:_imageView];
}

- (void)setModel:(imageModel *)model{
    _model = model;
    [self setNeedsLayout];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    NSURL *url = [NSURL URLWithString:_model.imageName];
    [_imageView sd_setImageWithURL:url];
}
@end
